﻿<%@ Page Title="" Language="vb" AutoEventWireup="false" MasterPageFile="~/OpenDelib.Master" CodeBehind="FicheRapport.aspx.vb" Inherits="OpenDelib.FicheRapport" %>
<%@ Register TagPrefix="asp" Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" %>
<%@ Register TagPrefix="cc1" Namespace="Odyssee.WebControles" Assembly="Odyssee.WebControles" %>

<asp:Content ID="Content1" ContentPlaceHolderID="head" runat="server">
    <style type="text/css">
        .gridview_jq_btn {
            vertical-align: middle;
        }
    </style>
</asp:Content>

<asp:Content ID="Content2" ContentPlaceHolderID="toolbar" runat="server">   
    <hr/>
    <cc1:ToolBar ID="tbDossier" runat="server" CssClass="toolbar">
        <items>
            <cc1:ToolBarTextImageButton ID="btnActualiser" runat="server" Text="Actualiser" ImageWidth="20" ImageHorizontalOffset="4" ImageUrl="~/Images/refresh_white_20.png" />
            <cc1:ToolBarSeparator ID="tbSep1" runat="server" Offset="2" />
            <cc1:ToolBarTextImageButton ID="btnEnregister" runat="server" Text="Enregistrer" ImageWidth="20" ImageHorizontalOffset="4" ImageUrl="~/Images/save_white_20.png" />
            <cc1:ToolBarSeparator ID="tbSep2" runat="server" Offset="2" />
            <cc1:ToolBarTextImageMenuButton ID="btnTraitements" runat="server" Text="Traitements" ImageWidth="20" ImageHorizontalOffset="4" ImageUrl="~/Images/filter_settings_white_20.png">
                <Items>
                </Items>
            </cc1:ToolBarTextImageMenuButton>
        </items>
    </cc1:ToolBar> 
    <hr/>
</asp:Content>

<asp:Content ID="Content3" ContentPlaceHolderID="content" runat="server">
    <cc1:JQPopupPanel ID="pnlRapport" runat="server" PopupHeight="540" PopupWidth="700" Style="display: none;" Close="True"  />

    <%--DIV DOSSIER--%>
    <div id="divDossier" class="bloc">
        <div class="divTitle">
            <asp:Label runat="server" Text="Rapport" CssClass="labelDivTitle" />
        </div>
        
        <%--OBJET--%>
        <div class="divMiniTitle">
            <asp:Label runat="server" Text="Objet" CssClass="label" />
        </div>
        <asp:TextBox ID="txtObjet" runat="server" TextMode="SingleLine" CssClass="textbox" Style="width:calc(100% - 6px);" MaxLength="40" />
        
        <%--RESUME--%>
        <div class="divMiniTitle">
            <asp:Label runat="server" Text="Résumé" CssClass="label" />
        </div>
        <asp:TextBox ID="txtResume" runat="server" TextMode="MultiLine" CssClass="textbox" Height="100px" Style="width:calc(100% - 6px);" />

        <%--TYPE DE RAPPORT--%>
        <div class="divMiniTitle">
            <asp:Label runat="server" Text="Type de rapport" CssClass="label" />
        </div>
        <asp:DropDownList ID="cmbTypeRapport" runat="server" CssClass="combo" Style="width: 100%; border: none;" />
        
        <%--SEANCE--%>
        <div class="divMiniTitle">
            <asp:Label runat="server" Text="Séance" CssClass="label" />
        </div>
        <div style="width:100%; display:flex;">
            <asp:DropDownList ID="cmbSeance" runat="server" AutoPostBack="true" CssClass="combo" Style="width: calc(100% - 215px); border: none;" />
            <asp:TextBox ID="txtCodeSeance" runat="server" CssClass="textbox" Width="100px" style="border-right: 1px solid black; border-left: 1px solid black;" Enabled="false" />
            <asp:TextBox ID="txtDebutValSeance" runat="server" CssClass="textbox" Width="100px" Enabled="false"/>
        </div>

        <%--COMMISSION--%>
        <div class="divMiniTitle">
            <asp:Label runat="server" Text="Commission" CssClass="label" />
        </div>
        <div style="width:100%; display:flex;">
            <asp:DropDownList ID="cmbCommission" runat="server" AutoPostBack="true" Enabled="false" CssClass="combo" Style="width: calc(100% - 215px); border: none;" />
            <asp:TextBox ID="txtCodeCommission" runat="server" CssClass="textbox" Width="100px" style="border-right: 1px solid black; border-left: 1px solid black;" Enabled="false" />
            <asp:TextBox ID="txtNbMembresCommission" runat="server" CssClass="textbox" Width="100px" Enabled="false"/>
        </div>

        <%--NUMERO ET NUMERO DEFINITIF--%>
        <div style="width:100%; display:flex;">
            <div class="divMiniTitle" style="width:50%; border-right: 1px solid black;">
                <asp:Label runat="server" Text="Numéro" CssClass="label" />
            </div>
            <div class="divMiniTitle" style="width:50%; border-left: 1px solid black;">
                <asp:Label runat="server" Text="Numéro définitif" CssClass="label" />
            </div>
        </div>
        <div style="width:100%; display:flex;">
            <div style="width:50%; border-right: 1px solid black;">
                <asp:TextBox ID="txtCode" runat="server" CssClass="textbox" Style="width:calc(100% - 6px);" Enabled="false" />
            </div>
            <div style="width:50%; border-left: 1px solid black;">
                <asp:TextBox ID="txtCleExt" runat="server" CssClass="textbox" Style="width:calc(100% - 6px);" Enabled="false" />
            </div>
        </div>

        <%--SIGNATURE ET VERSION--%>
        <div style="width:100%; display:flex;">
            <div class="divMiniTitle" style="width:calc(50% - 1px); border-right: 1px solid black;">
                <asp:Label runat="server" Text="Signature" CssClass="label" />
            </div>
            <div class="divMiniTitle" style="width:calc(50% - 1px); border-left: 1px solid black;">
                <asp:Label runat="server" Text="Version" CssClass="label" />
            </div>
        </div>
        <div style="width:100%; display:flex;">
            <div style="width:50%; border-right: 1px solid black;">
                <asp:TextBox ID="txtSignature" runat="server" CssClass="textbox" Style="width:calc(100% - 6px);" Enabled="false" />
            </div>
            <div style="width:50%; border-left: 1px solid black;">
                <asp:TextBox ID="txtVersion" runat="server" CssClass="textbox" Style="width:calc(100% - 6px);" Enabled="false" />
            </div>
        </div>
        
        <%--REDACTEUR--%>
        <div class="divMiniTitle">
            <asp:Label runat="server" Text="Rédacteur" CssClass="label" />
        </div>
        <div style="width:100%; display:flex;">
            <asp:TextBox ID="txtRedacteur" runat="server" CssClass="textbox" Style="width: calc(100% - 100px); border-right: 1px solid black;" Enabled="false" />
            <asp:TextBox ID="txtDomaineRedacteur" runat="server" CssClass="textbox" Width="100px" Enabled="false"/>
        </div>
    </div>

    <%--DIV INSTRUCTEURS--%>
    <div id="divInstructeurs" runat="server" class="bloc">
        <div class="divTitle">
            <asp:Label runat="server" Text="Instructeurs" CssClass="labelDivTitle" />
        </div>
        <cc1:AcroGridView ID="gvInstructeurs" runat="server" AutoGenerateColumns="false" CssClass="grid" AllowPaging="true" PageSize="10" PagerStyle-CssClass="gridpager" AllowSorting="false" EmptyDataText="Aucun instructeur" EmptyDataRowStyle-HorizontalAlign="Center" ShowHeaderWhenEmpty="True">
            <Columns>
                <cc1:BoundField DataField="LibelleDestinataire" ReadOnly="True" SortExpression="LibelleDestinataire" HeaderText="Nom" ItemStyle-HorizontalAlign="Left" HeaderStyle-HorizontalAlign="Left" HeaderStyle-Wrap="false" />
                <cc1:BoundField DataField="LibelleMotif" ReadOnly="True" SortExpression="LibelleMotif" HeaderText="Motif" ItemStyle-HorizontalAlign="Center" HeaderStyle-HorizontalAlign="Center" HeaderStyle-Wrap="false" />
                <asp:TemplateField HeaderText="Traité" SortExpression="Traitee" ItemStyle-HorizontalAlign="Center" HeaderStyle-HorizontalAlign="Center" HeaderStyle-Wrap="false">
                    <ItemTemplate><%#IIf(Boolean.Parse(Eval("Traitee").ToString()), "Oui", "Non")%></ItemTemplate>
                </asp:TemplateField>
                <asp:TemplateField HeaderText="Date de traitement" SortExpression="DateTraitement" ItemStyle-HorizontalAlign="Center" HeaderStyle-HorizontalAlign="Center" HeaderStyle-Wrap="false">
                    <ItemTemplate><%#IIf(CDate(Eval("DateTraitement")) = #12:00:00 AM#, "", CDate(Eval("DateTraitement")).ToShortDateString)%></ItemTemplate>
                </asp:TemplateField>
                <asp:TemplateField>
                    <ItemStyle HorizontalAlign="Right" />
                    <ItemTemplate>
                        <asp:ImageButton ID="btnTraiter" runat="server" AlternateText="Traiter" CommandArgument='<%# Eval("CleDiffusion") %>' CommandName="Traiter" Visible='<%# Eval("TraiterAutorise") %>' ImageUrl="~/Images/check_all_20.png" OnClientClick="return confirm('Êtes-vous sûr de vouloir traiter cette diffusion ?');" ToolTip="Traiter" style="vertical-align:bottom;" />
                    </ItemTemplate>
                </asp:TemplateField>
            </Columns>
        </cc1:AcroGridView>
    </div>

    <%--DIV NOMENCLATURE--%>
    <div id="divNomenclature" runat="server" class="bloc">
        <div class="divTitle">
            <asp:Label runat="server" Text="Nomenclature" CssClass="labelDivTitle" />
        </div>
        <cc1:AcroGridView ID="gvNomenclature" runat="server" AutoGenerateColumns="false" CssClass="grid" AllowPaging="true" PageSize="10" PagerStyle-CssClass="gridpager" AllowSorting="false" EmptyDataText="Aucune nomenclature" EmptyDataRowStyle-HorizontalAlign="Center" ShowHeaderWhenEmpty="True" style="border-bottom: 2px solid black; border-top: 2px solid black; height: 24px; line-height:24px; padding:0px;">
            <Columns>
                <cc1:BoundField DataField="Code" ReadOnly="True" SortExpression="Code" HeaderText="Descripteur" ItemStyle-HorizontalAlign="Left" HeaderStyle-HorizontalAlign="Left" HeaderStyle-Wrap="false" />
                <asp:TemplateField>
                    <ItemStyle HorizontalAlign="Right" />
                    <HeaderStyle HorizontalAlign="Right" />
                    <HeaderTemplate>
                        <cc1:JQPopupButton DoPostBack="true" Title="Ajouter un descripteur" PopupHeight="530" PopupWidth="530" PopupUrl="~/Commun/SelectionDescripteur.aspx" ID="btnAjouterNomenclature" runat="server" CssClass="btn" Text="Ajouter" DisplayMode="TextImageButton" PopupPanelID="pnlRapport" URLParameters="" ImageWidth="20" ImageHorizontalOffset="4" ImageUrl="~/Images/plus_white_20.png" ClientIDMode="Static" />
                    </HeaderTemplate>
                    <ItemTemplate>
                        <asp:ImageButton ID="btnSupprimer" runat="server" AlternateText="Supprimer" CommandArgument="" CommandName="Supprimer" ImageUrl="~/Images/cancel_20.png" OnClientClick="return confirm('Êtes-vous sûr de vouloir enlever cette nomenclature ?');" ToolTip="Supprimer" style="vertical-align:bottom;" />
                    </ItemTemplate>
                </asp:TemplateField>
            </Columns>
        </cc1:AcroGridView>
    </div>

    <%--DIV THEME--%>
    <div id="divTheme" runat="server" class="bloc">
        <div class="divTitle">
            <asp:Label runat="server" Text="Thème" CssClass="labelDivTitle" />
        </div>
        <cc1:AcroGridView ID="gvTheme" runat="server" AutoGenerateColumns="false" CssClass="grid" AllowPaging="true" PageSize="10" PagerStyle-CssClass="gridpager" AllowSorting="false" EmptyDataText="Aucun thème" EmptyDataRowStyle-HorizontalAlign="Center" ShowHeaderWhenEmpty="True" style="border-bottom: 2px solid black; border-top: 2px solid black; height: 24px; line-height:24px; padding:0px;">
            <Columns>
                <cc1:BoundField DataField="Code" ReadOnly="True" SortExpression="Code" HeaderText="Descripteur" ItemStyle-HorizontalAlign="Left" HeaderStyle-HorizontalAlign="Left" HeaderStyle-Wrap="false" />
                <asp:TemplateField>
                    <ItemStyle HorizontalAlign="Right" />
                    <HeaderStyle HorizontalAlign="Right" />
                    <HeaderTemplate>
                        <cc1:JQPopupButton DoPostBack="true" Title="Ajouter un descripteur" PopupHeight="530" PopupWidth="530" PopupUrl="~/Commun/SelectionDescripteur.aspx" ID="btnAjouterTheme" runat="server" CssClass="btn" Text="Ajouter" DisplayMode="TextImageButton" PopupPanelID="pnlRapport" URLParameters="" ImageWidth="20" ImageHorizontalOffset="4" ImageUrl="~/Images/plus_white_20.png" ClientIDMode="Static" />
                    </HeaderTemplate>
                    <ItemTemplate>
                        <asp:ImageButton ID="btnSupprimer" runat="server" AlternateText="Supprimer" CommandArgument="" CommandName="Supprimer" ImageUrl="~/Images/cancel_20.png" OnClientClick="return confirm('Êtes-vous sûr de vouloir enlever ce thème ?');" ToolTip="Supprimer" style="vertical-align:bottom;" />
                    </ItemTemplate>
                </asp:TemplateField>
            </Columns>
        </cc1:AcroGridView>
    </div>

    <%--DIV ORDRE DU JOUR--%>
    <div id="divOrdreJour" runat="server" class="bloc">
        <div class="divTitle">
            <asp:Label runat="server" Text="Ordre du jour" CssClass="labelDivTitle" />
        </div>
        <cc1:AcroGridView ID="gvOrdreJour" runat="server" AutoGenerateColumns="false" CssClass="grid" AllowPaging="true" PageSize="10" PagerStyle-CssClass="gridpager" AllowSorting="false" EmptyDataText="Aucun thème" EmptyDataRowStyle-HorizontalAlign="Center" ShowHeaderWhenEmpty="True" style="border-bottom: 2px solid black; border-top: 2px solid black; height: 24px; line-height:24px; padding:0px;">
            <Columns>
                <cc1:BoundField DataField="Code" ReadOnly="True" SortExpression="Code" HeaderText="Descripteur" ItemStyle-HorizontalAlign="Left" HeaderStyle-HorizontalAlign="Left" HeaderStyle-Wrap="false" />
                <asp:TemplateField>
                    <ItemStyle HorizontalAlign="Right" />
                    <HeaderStyle HorizontalAlign="Right" />
                    <HeaderTemplate>
                        <cc1:JQPopupButton DoPostBack="true" Title="Ajouter un descripteur" PopupHeight="530" PopupWidth="530" PopupUrl="~/Commun/SelectionDescripteur.aspx" ID="btnAjouterOrdreJour" runat="server" CssClass="btn" Text="Ajouter" DisplayMode="TextImageButton" PopupPanelID="pnlRapport" URLParameters="" ImageWidth="20" ImageHorizontalOffset="4" ImageUrl="~/Images/plus_white_20.png" ClientIDMode="Static" />
                    </HeaderTemplate>
                    <ItemTemplate>
                        <asp:ImageButton ID="btnSupprimer" runat="server" AlternateText="Supprimer" CommandArgument="" CommandName="Supprimer" ImageUrl="~/Images/cancel_20.png" OnClientClick="return confirm('Êtes-vous sûr de vouloir enlever cet ordre du jour ?');" ToolTip="Supprimer" style="vertical-align:bottom;" />
                    </ItemTemplate>
                </asp:TemplateField>
            </Columns>
        </cc1:AcroGridView>
    </div>
    
    <%--<br style="clear:both" />--%>

    <%--DIV PIECES JOINTES--%>
    <div id="divPiecesJointes" runat="server" class="bloc">
        <div class="divTitle">
            <asp:Label runat="server" Text="Pièces jointes" CssClass="labelDivTitle" />
        </div>
        <cc1:AcroGridView ID="gvPiecesJointes" runat="server" AutoGenerateColumns="false" CssClass="grid" AllowPaging="true" PageSize="10" PagerStyle-CssClass="gridpager" AllowSorting="false" EmptyDataText="Aucune pièce jointe" EmptyDataRowStyle-HorizontalAlign="Center" ShowHeaderWhenEmpty="True" style="border-bottom: 2px solid black; border-top: 2px solid black; height: 24px; line-height:24px; padding:0px;">
            <Columns>
                <cc1:BoundField DataField="Cle" ReadOnly="True" SortExpression="Cle" HeaderText="Numéro" ItemStyle-HorizontalAlign="Center" HeaderStyle-HorizontalAlign="Center" HeaderStyle-Wrap="false" Visible="false" />
                <cc1:BoundField DataField="Objet1" ReadOnly="True" SortExpression="Objet1" HeaderText="Objet" ItemStyle-HorizontalAlign="Left" HeaderStyle-HorizontalAlign="Left" HeaderStyle-Wrap="false" />
                <cc1:BoundField DataField="Type" ReadOnly="True" SortExpression="Type" HeaderText="Type" ItemStyle-HorizontalAlign="Center" HeaderStyle-HorizontalAlign="Center" HeaderStyle-Wrap="false" Visible="false" />
                <cc1:BoundField DataField="NomRedacteur" ReadOnly="True" SortExpression="NomRedacteur" HeaderText="Rédacteur" ItemStyle-HorizontalAlign="Center" HeaderStyle-HorizontalAlign="Center" HeaderStyle-Wrap="false" />
                <cc1:BoundField DataField="Etat" ReadOnly="True" SortExpression="Etat" HeaderText="Etat" ItemStyle-HorizontalAlign="Center" HeaderStyle-HorizontalAlign="Center" HeaderStyle-Wrap="false" />
                <asp:TemplateField SortExpression="CheminDocument">
                    <ItemStyle HorizontalAlign="Right" />
                    <HeaderStyle HorizontalAlign="Right" />
                    <HeaderTemplate>
                        <cc1:JQPopupButton DoPostBack="true" Title="Ajouter une pièce jointe" PopupHeight="540" PopupWidth="700" PopupUrl="~/Commun/CreerDocument.aspx" ID="btnAjouterPJ" runat="server" CssClass="btn" Text="Ajouter" DisplayMode="TextImageButton" PopupPanelID="pnlRapport" URLParameters="&selectionFichier=1&fichier=" ImageWidth="20" ImageHorizontalOffset="4" ImageUrl="~/Images/plus_white_20.png" ClientIDMode="Static" />
                    </HeaderTemplate>
                    <ItemTemplate>
                        <a href="<%#Eval("CheminDocument").ToString()%>" target="_blank" style=" border:none; text-decoration:none; visibility:<%#IIf(Eval("CheminDocument").ToString() = "", "hidden", "visible")%>;">
                            <img src="../Images/view_20.png" alt="Ouvrir" title="Ouvrir" style="vertical-align:bottom;" />
                        </a>
                        <cc1:JQPopupButton DoPostBack="true" Title="Modifier une pièce jointe" PopupHeight="540" PopupWidth="700" PopupUrl="~/Commun/CreerDocument.aspx" ID="btnModifierPJ" runat="server" Text="" DisplayMode="Image" PopupPanelID="pnlRapport" URLParameters='<%# "&modeFiche=1&cle=" & Eval("Cle") %>' ImageWidth="20" ImageHorizontalOffset="4" ImageUrl="~/Images/edit_20.png" ToolTip="Modifier la pièce jointe" CssClass="gridview_jq_btn" />
                        <asp:ImageButton ID="btnSupprimer" runat="server" AlternateText="Supprimer" CommandArgument='<%# Eval("Cle") %>' CommandName="Supprimer" ImageUrl="~/Images/cancel_20.png" OnClientClick="return confirm('Êtes-vous sûr de vouloir supprimer ce document ?');" ToolTip="Supprimer" style="vertical-align:bottom;" />
                    </ItemTemplate>
                </asp:TemplateField>
            </Columns>
        </cc1:AcroGridView>
        <div id="divHolder" class="dropzone dz-customstyle dz-default-colors">
        </div>
    </div>

    <script type="text/javascript">
        $(document).ready(function () {
            Sys.WebForms.PageRequestManager.getInstance().add_pageLoaded(function () { 
                initializeDropZone("<%=ResolveUrl("~/Rapport/FicheRapport.aspx") %>", "<%=ResolveUrl("~/Commun/CreerDocument.aspx") %>", "divHolder", "<%=Me.pnlRapport.ClientID%>");
            });
        });
    </script>

</asp:Content>
